#!/bin/bash
export JAVA_OPTS="-Xms300m -Xmx512m  -Djava.security.egd=file:/dev/./urandom"
#export JAVA_OPTS="-Xms300m -Xmx512m"
source /home/shell/location.sh
location $0
if [ $? == 1 ]
then
echo 'location error'
exit 0
fi
tomcat_basic=`getDir $LOCATION 1`
export CATALINA_HOME=$tomcat_basic/install/apache-tomcat
export CATALINA_BASE=$tomcat_basic/product
echo 'JAVA_HOME='$JAVA_HOME
echo 'CATALINA_HOME='$CATALINA_HOME
echo CATALINA_BASE=$CATALINA_BASE
case $1 in
	test)
	exit 0
	;;
	start)
	$CATALINA_HOME/bin/catalina.sh start
	echo start success
	;;
	stop)
		$CATALINA_HOME/bin/catalina.sh stop
		psKillerByName org.apache.catalina.startup.Bootstrap 1
	echo stop success
	;;
	restart)
		$CATALINA_HOME/bin/catalina.sh stop
		sleep 3
		psKillerByName org.apache.catalina.startup.Bootstrap 1
		$CATALINA_HOME/bin/catalina.sh start
	;;
	version)
	$CATALINA_HOME/bin/version.sh
	;;
	*)
	echo 'input error'
	;;
esac
